//
//  BSGzrModel.m
//  BaiSiBuDeJie
//
//  Created by chaoyi on 16/8/29.
//  Copyright © 2016年 tsaievan. All rights reserved.
//

#import "BSGzrTopModel.h"
#import "MJExtension.h"

@implementation BSGzrTopModel

+ (NSDictionary *)mj_objectClassInArray{
    
    return @{
             @"top_list" : @"Top_List"
             };
}

+ (NSDictionary *)mj_replacedKeyFromPropertyName{
    
    return @{
             
             @"last_coord" : @"info.last_coord"
             
             };
}

+ (NSURLSessionDataTask *)loadDataWith:(NSString *)url andSuccessBlock:(void (^)(BSGzrTopModel *infoList))successBlock andFailBlock:(void (^)(NSError *))failBlock andNoMoreBlock:(void(^)(NSString *str))noMoreBlock{
    
    AFHTTPSessionManager *manager = [AFHTTPSessionManager manager];
    
    
    __block NSURLSessionDataTask *task = [manager GET:url parameters:nil progress:nil success:^(NSURLSessionDataTask * _Nonnull task, id  _Nullable responseObject) {
        
        if([responseObject isKindOfClass:[NSDictionary class]]){
            
            BSGzrTopModel *model = [BSGzrTopModel mj_objectWithKeyValues:responseObject];
            
            //数据回调
            
            if(successBlock){
                
                successBlock(model);
                NSLog(@"%@",model);
            }
        }else{
            
            successBlock(nil);
        }
        
        
        
    } failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {
        
        if(failBlock){
            
            failBlock(error);
        }
        
    }];
    
    return task;
    
}



@end

@implementation Info

- (void)setValue:(id)value forUndefinedKey:(NSString *)key{
    
}

@end


@implementation Top_List



+ (NSDictionary *)mj_replacedKeyFromPropertyName{
    
    return @{
             
             @"id" : @"ID"
             
             };
}

@end


